using System;
using System.Net;
namespace com.haopintui.util
{
	public class HttpClient : WebClient
	{
		private CookieContainer cookieContainer;
		private bool allowAutoRedirect = true;
		public bool AllowAutoRedirect
		{
			get
			{
				return this.allowAutoRedirect;
			}
			set
			{
				this.allowAutoRedirect = value;
			}
		}
		public CookieContainer Cookies
		{
			get
			{
				return this.cookieContainer;
			}
			set
			{
				this.cookieContainer = value;
			}
		}
		public HttpClient()
		{
			this.cookieContainer = new CookieContainer();
		}
		public HttpClient(CookieContainer cookies)
		{
			this.cookieContainer = cookies;
		}
		protected override WebRequest GetWebRequest(Uri address)
		{
			WebRequest webRequest = base.GetWebRequest(address);
			if (webRequest is HttpWebRequest)
			{
				HttpWebRequest httpWebRequest = webRequest as HttpWebRequest;
				httpWebRequest.AllowAutoRedirect = this.allowAutoRedirect;
				httpWebRequest.CookieContainer = this.cookieContainer;
			}
			return webRequest;
		}
	}
}
